<script>
    $(function(){
        $('.product_cat').hide();
        $('#product_' + getHash()).show();
    });
</script>

    <div class="submenu">
        <table style="width: 100%; text-align: center; font-size: 16px; font-weight: bold;">
            <tr>
                <?foreach($categories as $k=>$category):?>
                    <td style="width: <?=100/count($categories);?>%;" onclick="show_cat('<?=$category['id'];?>');" class="category_button">
                        <span style="width: 100%;"><?=stripslashes($category['title']);?></span>
                    </td>
                <? endforeach; ?>
            </tr>
        </table>
    </div>

    <?foreach($categories as $k=>$category):?>
    <div class="product_cat" id="product_cat<?=$category['id'];?>">
        <h1 style="text-align: center; width: 100%; font-size: 22px;"><?=stripslashes($category['title']);?></h1>
        <div style="width: 100%; height: auto;">
            <?= str_replace('<br />', '<br />&nbsp;', nl2br(stripslashes($category['description'])));?>
        </div>
        <div class="clear"></div>
        <?if($products[$category['id']]):?>
            <? foreach ($products[$category['id']] as $key => $product): ?>
                <div class="product_area highlight" onclick="self.location='<?=BASE_URL;?>product.php?id=<?= $product['id']; ?>';">
                        <?if($product['logo']):?>
                            <img src="<?=BASE_URL . $product['logo'];?>" class="product_img" />
                        <?endif;?>
                        <strong><?= stripslashes($product['title']); ?></strong><br />
                        <div class="clear"></div>
                        &nbsp;&nbsp;<?= str_replace('<br />', '<br />&nbsp;', nl2br(stripslashes($product['description'])));?>
                    <br />
                    <a href="<?=BASE_URL;?>product.php?id=<?= $product['id']; ?>">Подробнее...</a>
                </div>
            <? endforeach; ?>
        <?endif;?>
    </div>
    <?endforeach;?>
<div class="clear"></div>